package com.devunion.salon.core.model;

import javax.persistence.Entity;
import javax.persistence.DiscriminatorValue;
import java.util.Date;
import java.util.Calendar;

/**
 * @author spetrakovsky
 */
@Entity
@DiscriminatorValue("HISTORY")
public class ProductHistory extends BaseProduct {

    private Date time;

    private Long productId;

    public ProductHistory() {
    }

    public ProductHistory(Product product) {
        setName(product.getName());
        setBarCode(product.getBarCode());
        setDescription(product.getDescription());
        setVendor(product.getVendor());
        setInventoryDepartment(product.getInventoryDepartment());
        setTaxable(product.isTaxable());
        setDiscount(product.isDiscount());
        setPriceOverrides(product.isPriceOverrides());
        setPrice(product.getPrice());
        setMarkup(product.getMarkup());
        setRetailPrice(product.getRetailPrice());
        setUom(product.getUom());
        setQty(product.getQty());
        setReorderAt(product.getReorderAt());
        setProductId(product.getId());
        this.time = Calendar.getInstance().getTime();
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

}
